﻿/**
* @author maze | guavestudios.com
* @license MIT License see LICENSE.TXT
* @version 0.1
*/
package  {
	import net.ws.fcon.api.IControlableConsole;
	import net.ws.fcon.api.INamedCommand;

	public class SampleCommand implements INamedCommand{
		private var action:Function;

	//{ GETTER-SETTER
		/**
		* TODO Insert description from GET action here.
		*  
		*  @return Function
		*/
		public function getAction():Function {
			return this.action;
		}
		/**
		* TODO Insert description from SET action here.
		*  
		*  @param paction[Function]
		*  @return
		*/
		public function setAction(paction:Function) {
			this.action = paction;
		}
	//}
		
		public function SampleCommand() {
			
		}
		
		/**
		* execute the command
		* @param	args parameters for the command
		*/
		public function execute(args:Array):void
		{
			//Default passed as first arg is the console itself
			IControlableConsole(args[0]).outputText("EXECUTED CUSTOM FUNCTION!");
			if (action)
			{
				//if weve set an action, execute it
				action();
			}
		}
		/**
		* returns the unique command name
		* @return name
		*/
		public function getCommandName():String
		{
			//the command id
			return "sample";
		}
	}
	
}
